package com.qidian.mes.qc.controller;

import com.qidian.mes.pojo.Ipqc;
import com.qidian.mes.qc.service.IpqcService;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@CrossOrigin
@RequestMapping("/ipqc")
public class IpqcController {
    @Autowired
    private IpqcService ipqcService;

    @GetMapping("/get")
    public MESResult get(Long ipqcId){
        return ipqcService.queryById(ipqcId);
    }

    @GetMapping("/list")
    public MESResult list(@RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10") int limit, Ipqc ipqc){

        return  ipqcService.list(page,limit,ipqc);
    }

    @PostMapping("save")
    public MESResult save(@RequestBody Ipqc ipqc){
        return ipqcService.save(ipqc);
    }
    //编辑
    @PutMapping("/update")
    public MESResult update(@RequestBody Ipqc ipqc)  {
        return ipqcService.update(ipqc);
    }

    @DeleteMapping("/{ipqcId}")
    public MESResult deleteById(@PathVariable Long ipqcId) {
        return ipqcService.deleteByIpqcId(ipqcId);
    }
    @DeleteMapping("/deletes")
    public MESResult deletesByIpqcId(Long[] ipqcId) {

        return ipqcService.deletesByIpqcId(ipqcId);

    }

}
